﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class demo : MonoBehaviour {

    public InputField un;
    public InputField pw;


    public void init () {
        CJ.XNFZ.ILABX.ILABXHelper.Instance.GetConfig (
            () => {
                Debug.Log ("ok");
            },
            (string e) => {
                Debug.Log (e);
            }

        );
        CJ.XNFZ.Server.XNFZServerHelper.Instance.GetConfig (
            () => {
                Debug.Log ("ok");
            },
            (string e) => {
                Debug.Log (e);
            }

        );
    }

    public void trytoken () {
        CJ.XNFZ.ILABX.ILABXHelper.Instance.Token (
            () => {
                Debug.Log ("ok");
                CJ.XNFZ.SCORE.ScoreSystemHelper.Instance.userType = CJ.XNFZ.SCORE.ScoreSystemHelper.UserType.ilabx;
            },
            (string e) => {
                Debug.Log (e);
            }

        );
    }

    public void login () {
        CJ.XNFZ.Server.XNFZServerHelper.Instance.Login (
            un.text,
            pw.text,
            () => {
                Debug.Log ("ok");
                CJ.XNFZ.SCORE.ScoreSystemHelper.Instance.userType = CJ.XNFZ.SCORE.ScoreSystemHelper.UserType.student;
            },
            (string e) => {
                Debug.Log (e);
            }

        );
    }

    public void regist () {
        CJ.XNFZ.Server.XNFZServerHelper.Instance.Regist (
            un.text,
            pw.text,
            () => {
                Debug.Log ("ok");
            },
            (string e) => {
                Debug.Log (e);
            }

        );
    }

    public void goadmin () {
        CJ.XNFZ.Server.XNFZServerHelper.Instance.GoAdmin ();
    }

    public void guest () {
        CJ.XNFZ.SCORE.ScoreSystemHelper.Instance.userType = CJ.XNFZ.SCORE.ScoreSystemHelper.UserType.specialist;
    }

    public void checkin () {
         CJ.XNFZ.SCORE.ScoreSystemHelper.Instance.Checkin ();
    }

    public void logscroe () {
        CJ.XNFZ.TimeHelper.Instance.SetStart ();
        CJ.XNFZ.TimeHelper.Instance.SetStop ();
        List<string> k = new List<string> ();
        List<string> v = new List<string> ();
        k.Add ("score");
        v.Add ("80");
        // CJ.XNFZ.SCORE.ScoreSystemHelper.Instance.UploadScore (
        //    "子项目名称",
        //    "a-part",
        //    "1",
        //    80,
        //    CJ.XNFZ.TimeHelper.Instance.startTime,
        //    CJ.XNFZ.TimeHelper.Instance.endTime,
        //    CJ.XNFZ.TimeHelper.Instance.GetUsedTime (),
        //    k,
        //    v,
        //    () => {
        //        Debug.Log ("ok");
        //    },
        //    (string e) => {
        //        Debug.Log (e);
        //    }
        //);
    }
}